Skip to content

[front] fix: paginate active user metrics query - #30219

Merged
aubin-tchoi merged 2 commits into
mainfrom
fix-user-query
Aug 10, 2026
Merged

[front] fix: paginate active user metrics query#30219
aubin-tchoi merged 2 commits into
mainfrom
fix-user-query

Conversation

@aubin-tchoi

@aubin-tchoi aubin-tchoi commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Closes https://github.com/dust-tt/tasks/issues/9977

We are seeing errors from fetchActiveUsersMetrics, which bubbles up 400 errors from Elasticsearch (sample trace).
#30251 improves the error handling to better trace the error from Elasticsearch, in the meanwhile this PR fixes an issue we will have for sure on large workspaces such as the one in the issue: the ES query made in fetchActiveUsersMetrics can exceed the max number of buckets. It creates one bucket per user x day, some workspaces have enough users to exceed the max.

This PR adds some pagination around the aggregation, fetched in pages of 10,000 buckets, so that each ES query stays bounded and under the limit.

Tests

  • Added tests.

Risk

  • Low.

Deploy Plan

  • Deploy front.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
playground Ignored Ignored Preview Aug 10, 2026 12:57pm
storybook Ignored Ignored Preview Aug 10, 2026 12:57pm

Request Review

@dust-agent dust-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding Rules LGTM \o/

@davidebbo davidebbo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aubin-tchoi
aubin-tchoi merged commit 2a8ed26 into main Aug 10, 2026
45 checks passed
@aubin-tchoi
aubin-tchoi deleted the fix-user-query branch August 10, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants